package com.atguigu.userprofile.dao;

import com.atguigu.userprofile.bean.TaskTagRule;
import com.atguigu.userprofile.utils.MySQLUtil;

import java.util.List;

/**
 * ClassName: TaskTagRuleDAO
 * Package: com.atguigu.userprofile.dao
 * Description:
 *
 * @Author ChenJun
 * @Create 2023/3/29 11:18
 * @Version 1.0
 */
public class TaskTagRuleDAO {

    public static List<TaskTagRule> getTaskTagRule(String taskId){
        String querySQL = "SELECT \n" +
                "ttr.id,\n" +
                "ttr.`tag_id`,\n" +
                "ttr.`task_id`,\n" +
                "ttr.`query_value`,\n" +
                "ttr.`sub_tag_id`,\n" +
                "ti.tag_name  as sub_tag_value\n" +
                "FROM task_tag_rule ttr\n" +
                "JOIN tag_info ti\n" +
                "ON ttr.`sub_tag_id` = ti.id\n" +
                "WHERE task_id ="+taskId+"";
        List<TaskTagRule> taskTagRules = MySQLUtil.queryList(querySQL, TaskTagRule.class, true);
        return taskTagRules;
    }
}
